import HttpRequest from '@/utils/HttpRequest'

//每个活动都要用到的接口，例如openid登录、修改用户手机号码头像昵称等
const baseApi = {
	auth:{
		//使用openid作为账号登录
		loginByWxOpenid(data, callback){
			var url = '/auth/loginByWxOpenid';
					
			HttpRequest.post(url, data, callback, 'json', {loading: false, toast: false})	
		},
		logout(data, callback){
			var url = '/auth/logout';
					
			HttpRequest.post(url, data, callback, 'json', {loading: true, toast: true})	
		},
	},
	//用户接口
	user:{
		getUserInfo(data, callback){
			var url = '/user/getUserInfo';
		
			HttpRequest.post(url, data, callback, 'json', {loading: true, toast: false})					
		},
		updateUserInfo(data, callback){
			var url = '/user/updateUserInfo';
		
			HttpRequest.post(url, data, callback, 'json', {loading: true, toast: false})					
		},
		uploadImage(file, data, callback){
			var url = '/user/uploadImage';
		
			HttpRequest.uploadFile(url, file, data, callback)					
		},
		getWxPhoneNumber(data, callback){
			var url = '/user/getWxPhoneNumber';
			HttpRequest.post(url, data, callback, 'json', {loading: true, toast: false})					
		},
	},
	app:{
		//入口首页数据接口
		getAppInfo(data, callback){
			var url = '/app/getAppInfo';
		
			HttpRequest.post(url, data, callback, 'json', {loading: true, toast: false})					
		},
	},
	
}

export default baseApi;